﻿using System;

namespace IQIGame.Onigao.GamePlay
{
    public struct PetFilter : IEquatable<PetFilter>
    {
        public int orgType; // 标签类型
        public int wearState; // 穿戴状态(0-无,1-穿戴,2-未穿戴)
        public int lockState; // 锁定状态(0-无,1-锁定,2-未锁定)

        public PetFilter(int orgType, int wearState, int lockState) : this()
        {
            this.Sync(orgType, wearState, lockState);
        }

        public PetFilter Sync(int orgType, int wearState, int lockState)
        {
            this.orgType = orgType;
            this.wearState = wearState;
            this.lockState = lockState;
            return this;
        }

        public PetFilter Sync(PetFilter other)
        {
            return this.Sync(other.orgType, other.wearState, other.lockState);
        }

        public override bool Equals(object obj)
        {
            if (obj is PetFilter other)
                return Equals(other);
            return false;
        }

        public override int GetHashCode()
        {
            return HashCode.Combine(orgType, wearState, lockState);
        }

        public bool Equals(PetFilter other)
        {
            return this.orgType == other.orgType && this.wearState == other.wearState && this.lockState == other.lockState;
        }

        static public readonly PetFilter Default = new PetFilter(0, 0, 0);

        public static bool operator ==(PetFilter lhs, PetFilter rhs) { return lhs.Equals(rhs); }
        public static bool operator !=(PetFilter lhs, PetFilter rhs) { return !(lhs == rhs); }
    }
}
